package com.tvein.sanguo.model
{
	//flash
	//pureMVC
	import org.puremvc.as3.multicore.interfaces.IProxy;
	import org.puremvc.as3.multicore.patterns.proxy.Proxy;
	//custom
	import com.tvein.sanguo.common.CommonConstants;
//
	public class ServerProxy extends Proxy implements IProxy
	{
		public static const NAME:String = "ServerProxy";
		
		public function ServerProxy()
		{
			super(NAME);
		}
		
		//Custom
		
		//p2pStatus
		private var _p2pStatus:Boolean;
		
		public function set p2pStatus(value:Boolean) : void
		{
			_p2pStatus = value;
		}
		
		public function get p2pStatus() : Boolean
		{
			return _p2pStatus;
		}
		
		//Sever Info
		private var _serverXML:XML;
		private var _srcServer:XMLList;
		private var _gameServer:String;
		private var _sfsServer:Array;
		
		public function set serverXML(value:XML) : void
		{
			_serverXML = value;
			_srcServer = value.srcServer.src;
			_gameServer = value.gameServer.game.@address;
			_sfsServer = [value.sfsServer.sfs.@host, value.sfsServer.sfs.@port];
		}
		
		public function get serverXML() : XML
		{
			return _serverXML;
		}
		
		public function get srcServer() : XMLList
		{
			return _srcServer;
		}
		
		public function get gameServer() : String
		{
			return _gameServer;
		}
		
		public function get sfsServer() : Array
		{
			return _sfsServer;
		}
		
		//SWF name
		public var swfNum:int = 0;
		private var _swfName:Array = new Array();
		
		public function setSwfName(name:String, instance:String) : void
		{
			_swfName[name] = instance;
			swfNum ++;
		}
		
		public function getSwfInstance(name:String) : String
		{
			return _swfName[name];
		}
	}
}